package com.hippy.erya.modular.erya;

import com.hippy.erya.base.pojo.page.LayuiPageFactory;
import com.hippy.erya.base.pojo.page.LayuiPageInfo;
import com.hippy.erya.impl.MemberServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.websocket.server.PathParam;

@Slf4j
@Controller
@RequestMapping("/erya/member")
public class MemberController {

    @Autowired
    private MemberServiceImpl memberService;

    @RequestMapping(value = "/member")
    public String member() {
        return "/erya/member/member_setting.html";
    }

    @RequestMapping("/queryAll")
    @ResponseBody
    public LayuiPageInfo queryByPage(@PathParam("page") Long page, @PathParam("limit") int limit,
                                     @PathParam("memberName") String memberName,
                                     @PathParam("memberGrade") String memberGrade) {
        return LayuiPageFactory.createPageInfo(memberService.queryByPage(page, limit, memberName, memberGrade));
    }

}
